#ifndef TESTMAINWINDOW_H
#define TESTMAINWINDOW_H


#include <QMainWindow>
#include <QStandardItemModel>

class QAction;
class QMenu;
class QTextEdit;
class QTableView;

class TestMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    TestMainWindow();
    TestMainWindow(const QString &fileName);
    virtual void loadFile(const QString &fileName);

 protected:
    void closeEvent(QCloseEvent *event);

 private slots:
    void newFile();
    void open();
    bool save();
    bool saveAs();
    void about();
    void documentWasModified();

 private:
    void init();
    void createActions();
    void createMenus();
    void createToolBars();
    void createStatusBar();
    void readSettings();
    void writeSettings();
    bool maybeSave();


    bool saveFile(const QString &fileName);
    void setCurrentFile(const QString &fileName);

    QString strippedName(const QString &fullFileName);
    TestMainWindow *findMainWindow(const QString &fileName);

    bool isUntitled;

    QStandardItemModel model;

    QTabWidget *tabWidget;

    QTextEdit *textEdit;
    QTableView *tableView;

    QString  curFile;
    QMenu    *fileMenu;
    QMenu    *editMenu;
    QMenu    *helpMenu;
    QToolBar *fileToolBar;
    QToolBar *editToolBar;
    QAction  *newAct;
    QAction  *openAct;
    QAction  *saveAct;
    QAction  *saveAsAct;
    QAction  *closeAct;
    QAction  *exitAct;
    QAction  *aboutAct;
    QAction  *aboutQtAct;

};

#endif // TESTMAINWINDOW_H
